import {ResDto} from "../types/common";
import instance from "../axios.service";
import {BaseUrl} from "../common/constants";

export default {
    getList: (params: any): Promise<ResDto> => instance.get(`${BaseUrl}/v1/device/info`, {params}),
    getListByWdCode: (wdCode: string): Promise<ResDto> => instance.get(`${BaseUrl}/v1/device/${wdCode}`),
    create: (data: any): Promise<ResDto> => instance.post(`${BaseUrl}/v1/device/add`, data),
    edit: (data: any): Promise<ResDto> => instance.put(`${BaseUrl}/v1/device/${data.id}`, data),
    del: (id: any): Promise<ResDto> => instance.delete(`${BaseUrl}/v1/device/${id}`),
    qrcode: (bianhao: string): Promise<ResDto> => instance.get(`${BaseUrl}/v1/device/qrc/${bianhao}`, {
        responseType: 'blob'
    }),
}
